#include <stdio.h>


typedef union STM_32
{
    int M_ALL_pwm;
    int M_1_pwm;
    int M_2_pwm;
    int M_3_pwm;
}STM_32;

int main(int argc, char const *argv[])
{
    STM_32 PWM;
    // 联动
    int M_1 = PWM.M_1_pwm;
    int M_2 = PWM.M_2_pwm;
    int M_3 = PWM.M_3_pwm;

    // 设置电机转速
    M_1 = 50;
    M_2 = 70;
    M_3 = 80;
    
    // 统一设置转速
    PWM.M_ALL_pwm = 120;
    M_1 = PWM.M_1_pwm;
    M_2 = PWM.M_2_pwm;
    M_3 = PWM.M_3_pwm;
    
    // 显示电机转速
    printf("M_1 = %d\n" , M_1);
    printf("M_2 = %d\n" , M_2);
    printf("M_3 = %d\n" , M_3);

    return 0;
}







